package com.itlong.cloud.equip.commons;

import com.itlong.cloud.POJO.DTO.property.*;
import com.itlong.cloud.POJO.VO.property.*;
import com.itlong.cloud.utils.page.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <desc>
 *      云电梯业务暴露接口
 * </desc>
 *
 * @createDate 2018/03/28
 */
@FeignClient(name = "equip-service")
public interface ICloudElevatorServiceClient {
    /**
     * <desc>
     *      获取云电梯设备状态
     * </desc>
     *
     * @param sn
     * @return
     * @author Jiaqi.X
     * @createDate 2018/03/28
     */
    @RequestMapping(path = "/smartCommunity/interface/elevator/getDeviceStatus",method = RequestMethod.POST)
    public Integer getDeviceStatus(@RequestParam("sn") String sn);

    /**
     * <desc>
     *      云电梯设备登录
     * </desc>
     *
     * @param sn
     * @param encryptionAbility 加密类型 0—设备不支持加密传输、1—设备支持自有加密方案、2—设备支持HTTPS安全传输、3—设备同时支持自有加密方案和HTTPS安全传输。
     * @return
     * @author Jiaqi.X
     * @createDate 2018/03/28
     */
    @RequestMapping(path = "/smartCommunity/interface/elevator/login",method = RequestMethod.POST)
    public CloudElevatorVO login(@RequestParam("sn")String sn,
                                 @RequestParam("encryptionAbility")String encryptionAbility) throws Exception;

    /**
     * <desc>
     *      通过token获取用户信息
     * </desc>
     *
     * @param token
     * @return
     * @author Jiaqi.X
     * @createDate 2018/03/29
     */
    @RequestMapping(path = "/smartCommunity/interface/elevator/retrieve",method = RequestMethod.POST)
    CloudElevatorVO retrieve(@RequestParam("token")String token);

    /**
     * <desc>
     *      更新云电梯缓存iot信息
     * </desc>
     *
     * @param cloudElevatorVO
     * @return
     * @author Jiaqi.X
     * @createDate 2018/03/29
     */
    @RequestMapping(path = "/smartCommunity/interface/elevator/updateCloudElevatorIotCacheInfo",method = RequestMethod.POST)
    CloudElevatorVO updateCloudElevatorIotCacheInfo(@RequestBody CloudElevatorVO cloudElevatorVO);


    /**
     * <desc>
     *      上报设备能力集
     * </desc>
     *
     * @param deviceUnique 设备唯一码
     * @param productKey 阿里云产品key
     * @param deviceProJs 设备属性
     * @author Jiaqi.X
     * @createDate 2018/03/29
     */
    @RequestMapping(path = "/smartCommunity/interface/elevator/reportCapacitySet",method = RequestMethod.POST)
    void reportCapacitySet(@RequestParam("deviceUnique")String deviceUnique,
                           @RequestParam("productKey")String productKey,
                           @RequestParam("deviceProJs")String deviceProJs) throws Exception;

    /**
     * <desc>
     *      获取固定密码
     * </desc>
     *
     * @param dto
     * @return
     * @author Jiaqi.X
     * @createDate 2018/03/30
     */
    @RequestMapping(path = "/smartCommunity/interface/elevator/pullDevicePwd",method = RequestMethod.POST)
    CloudElevatorRoomPwdPageVO pullDevicePwd(@RequestBody CloudElevatorPageDTO dto) throws Exception;

    /**
     * <desc>
     *      获取轮询数据分页列表
     * </desc>
     *
     * @param dto
     * @return
     * @author Jiaqi.X
     * @createDate 2018/04/03
     */
    @RequestMapping(path = "/smartCommunity/interface/elevator/getChangeLogPage",method = RequestMethod.POST)
    public Page<CloudElevatorChangeLogPageVO> getChangeLogPage(@RequestBody CloudIntercomChangeLogGetDTO dto) throws Exception;


    /**
     * <desc>
     *     云电梯设备批量完成轮询命名
     * </desc>
     *
     * @param sn
     * @param ids 轮询命令，多个以英文逗号拼接
     * @return 受影响的行数
     * @throws Exception
     * @author wangzhi
     * @createDate 2018-04-03
     */
    @PostMapping(path = "smartCommunity/interface/elevator/batchFinishChangeLogOrders")
    Integer batchFinishChangeLogOrders(@RequestParam("sn") String sn,
                                       @RequestParam("ids") String ids,
                                       @RequestParam(value = "deviceType",required = false) String deviceType) throws Exception;

    /**
     * <desc>
     *      校验动态开门密码
     * </desc>
     *
     * @param dto
     * @return
     * @author Jiaqi.X
     * @createDate 2018/04/11
     */
    @PostMapping(path = "smartCommunity/interface/elevator/checkDynamicPwd")
    public Boolean checkDynamicPwd(@RequestBody CloudIntercomDynamicPwdCheckDTO dto) throws Exception;


    /**
     * <desc>
     *      生成刷卡通行记录
     * </desc>
     *
     * @param token
     * @return 记录id
     * @author Jiaqi.X
     * @createDate 2018/04/28
     */
    @PostMapping(path = "smartCommunity/interface/elevator/saveCardPassRecord")
    String saveCardPassRecord(@RequestParam("token") String token) throws Exception;



    /**
     * <desc>
     *      获取云电梯设备更新信息
     * </desc>
     *
     * @param sn
     * @param filePackage 安装文件 包名
     * @param versionCode 安装文件 版本号
     * @param deviceType 软件类型 0安卓APK程序，1安卓系统固件，2按键单片机固件
     * @return
     * @author Qiang.S
     * @createDate 2018/08/30
     */
    @RequestMapping(path = "smartCommunity/interface/elevator/deviceElevatorUpdate")
    CloudDeviceUpdateInfoVO deviceElevatorUpdate(@RequestParam("sn") String sn,
                                                 @RequestParam(value = "filePackage",required = false) String filePackage,
                                                 @RequestParam("versionCode") String versionCode,
                                                 @RequestParam("deviceType") String deviceType)  throws Exception;
    /**
     * <desc>
     *      获取群控器设备更新信息
     * </desc>
     *
     * @param sn
     * @param filePackage 安装文件 包名
     * @param versionCode 安装文件 版本号
     * @param deviceType 软件类型 0安卓APK程序，1安卓系统固件，2按键单片机固件
     * @return
     * @author Qiang.S
     * @createDate 2018/08/30
     */
    @RequestMapping(path = "smartCommunity/interface/elevator/deviceClusterUpdate")
    CloudDeviceUpdateInfoVO deviceClusterUpdate(@RequestParam("sn") String sn,
                                                 @RequestParam(value = "filePackage",required = false) String filePackage,
                                                 @RequestParam("versionCode") String versionCode,
                                                 @RequestParam("deviceType") String deviceType)  throws Exception;

    /**
     * <desc>
     *      获取云设备的楼层映射信息
     * </desc>
     *
     * @param sn
     * @param deviceType
     * @return
     * @author Jiaqi.X
     * @createDate 2018/11/22
     */
    @PostMapping(path = "smartCommunity/interface/elevator/getCloudDeviceFloorInfo")
    CloudDeviceFloorInfoVO getCloudDeviceFloorInfo(@RequestParam("sn") String sn,@RequestParam(value = "deviceType",required = false) String deviceType);

    /**
     * <desc>
     *      获取云电梯设备服务权限信息
     * </desc>
     *
     * @param getDTO
     * @return
     * @author Qiang.S
     * @createDate 2019/04/26
     */
    @PostMapping(path = "smartCommunity/interface/elevator/getDeviceServeRoomsByPage")
    Page<CloudElevatorDeviceAuthVO.Room> getDeviceServeRoomsByPage(@RequestBody CloudIntercomDeviceAuthGetDTO getDTO);

    /**
     * <desc>
     *      获取房间下的住户信息
     * <desc/>
     *
     * @param roomIds 房间id
     * @return
     * @author Qiang.S
     * @createDate 2019-04-26
     */
    @RequestMapping(path = "smartCommunity/interface/elevator/getUsersByRoomIds",method = {RequestMethod.POST})
    List<CloudElevatorDeviceAuthVO.RoomUser> getUsersByRoomIds(@RequestParam("roomIds") String roomIds) throws Exception;

    /**
     * <desc>
     *      根据设备编号获取访客信息
     * </desc>
     *
     * @param deviceUnique 设备唯一码
     * @return
     * @author Qiang.S
     * @createDate 2019/04/26
     */
    @PostMapping(path = "smartCommunity/interface/elevator/getVisitorInfoByUnique")
    List<CloudIntercomVisitorVO> getVisitorInfoByUnique(@RequestParam("deviceUnique") String deviceUnique);

    /**
     * <desc>
     *      获取云电梯临时权限
     * </desc>
     *
     * @param sn
     * @return
     * @author Jiaqi.X
     * @createDate 2019/09/11
     */
    @PostMapping(path = "smartCommunity/interface/elevator/getTempAuths")
    DeviceAuthTempPageVO<ElevatorTempAuthVO> getTempAuths(@RequestParam("sn") String sn, @RequestParam("currentPage") String currentPage,
                                                          @RequestParam("pageSize") String pageSize) throws Exception;
    /**
     * <desc>
     *     通知云端升级失败原因
     * </desc>
     *
     * @param sn
     * @param id 轮询命令
     * @param msg 失败原因
     * @return 受影响的行数
     * @throws Exception
     * @author Qiang.S
     * @createDate 2019-08-12
     */
    @PostMapping(path = "smartCommunity/interface/elevator/reportUpdateResult")
    Integer reportUpdateResult(@RequestParam("sn") String sn,
                               @RequestParam("id") String id,
                               @RequestParam("msg") String msg) throws Exception;

    /**
     * <desc>
     *      获取黑名单信息
     * </desc>
     *
     * @param sn
     * @param page
     * @param pageSize
     * @return
     * @author Jiaqi.X
     * @createDate 2019/10/14
     */
    @PostMapping(path = "smartCommunity/interface/elevator/pullBlackList")
    DeviceBlackListPageVO<BlackListVO> pullBlackList(@RequestParam("sn") String sn,@RequestParam("page") String page,@RequestParam("pageSize") String pageSize);

    /**
     * <desc>
     *      校验用户信息（目前获取用户或卡号所在房间的通行所剩次数）
     * </desc>
     *
     * @param dto 校验用户信息dto类
     * @return
     * @author Juguang.S
     * @createDate 2020/12/25
     */
    @RequestMapping(path = "/smartCommunity/interface/elevator/checkUserInfo",method = RequestMethod.POST)
    Integer checkUserInfo(@RequestBody CloudDeviceCheckUserInfoDTO dto) throws Exception;

    /**
     * <desc>
     *      上报告警信息
     * </desc>
     *
     * @param deviceUnique 设备唯一码
     * @param alarms 告警信息
     * @author Juguang.S
     * @createDate 2021/05/28
     */
    @RequestMapping(path = "/smartCommunity/interface/pushAlarmEvent",method = RequestMethod.POST)
    void pushAlarmEvent(@RequestParam("deviceUnique")String deviceUnique,
                        @RequestBody List<CloudElevatorAlarmInfoDTO> alarms) throws Exception;

    /**
     * <desc>
     *      查询云电梯所绑定的摄像头相关参数配置
     * </desc>
     *
     * @param cloudElevatorVO
     * @return
     * @author Juguang.S
     * @createDate 2021/05/31
     */
    @RequestMapping(path = "/smartCommunity/interface/elevator/getAiCameraInfoByElevatorDeviceUnique",method = RequestMethod.POST)
    DeviceAiCameraInfoVO getAiCameraInfoByElevatorDeviceUnique(@RequestBody CloudElevatorVO cloudElevatorVO) throws Exception;

}
